import Vue from "vue";
import VueRouter from "vue-router";
import staticRoute from "./staticRoute";
Vue.use(VueRouter);

const routes = [
  { path: "/", redirect: "/home" },
  {
    path: "*",
    redirect: "/404",
  },
  {
    path: "/login",
    component: () =>
      import(/*webpackChunkName:'login' */ "../pages/login/index.vue"),
  },
  {
    path: "/home",
    name: "home",
    title: "首页",
    meta: {
      title: "首页",
    },
    Icon: "el-icon-house",
    component: () =>
      import(/*webpackChunkName:'home' */ "../pages/home/HomePage.vue"),
  },
  {
    path: "/demo",
    name: "DemoModule",
    title: "功能演示",
    icon: "el-icon-guide",
    meta: {
      title: "功能演示",
      icon: "el-icon-guide",
      requiresAuth: true,
      order: 2,
    },
    component: () =>
      import(/* webpackChunkName: "demo" */ "@/pages/demo/index.vue"),
    children: [...staticRoute], // 静态子路由
  },
  {
    path: "/404",
    meta: {
      title: "Page not found",
      isLogin: false,
    },
    component: () =>
      import(/*webpackChunkName:'404' */ "../pages/NotFound/index.vue"),
  },
];

const router = new VueRouter({
  routes,
});

export default router;
